//
//  StoryTableViewCell.m
//  B
//
//  Created by Znt on 15/11/6.
//  Copyright © 2015年 wangzhan. All rights reserved.
//

#import "StoryTableViewCell.h"
#import "Model3.h"
@implementation StoryTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

   self =  [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatSubviews];
    }
    return self;
}

- (void)creatSubviews {

    self.mainImage = [[UIImageView alloc]initWithFrame:CGRectMake(25  *XWIDTH, 0, 325 *XWIDTH, 400 *XHIGHT)];
    self.mainImage.layer.masksToBounds = YES;
    self.mainImage.layer.cornerRadius = 10;
    [self.contentView addSubview:self.mainImage];
    
    self.mainLabel = [[UILabel alloc]initWithFrame:CGRectMake(25  *XWIDTH, 410 *XHIGHT, 325 *XWIDTH, 40 *XHIGHT)];
    [self.contentView addSubview:self.mainLabel];
    self.mainLabel.textColor = [UIColor blackColor];
    self.mainLabel.font = [UIFont systemFontOfSize:13];
    //  [self .mainLabel sizeToFit];
    self.mainLabel.numberOfLines = 0;
    
    
    
}


- (void)setModel3:(Model3 *)model3 {

    _model3 = model3;
    
    [self.mainImage sd_setImageWithURL:[NSURL URLWithString:_model3.photo] placeholderImage:[UIImage imageNamed:@""]];
    [[self mainLabel]setText:_model3.text];
    
   CGFloat height =  [AppTools heightForCell:_model3.text andFont:13];
    CGRect temp = self.mainLabel.frame;
    temp.size.height = height;
    self.mainLabel.frame = temp;
    NSLog(@"^^^%@",_model3.text);

}





@end
